import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';

part 'category_event.dart';
part 'category_state.dart';

class CategoryBloc extends Bloc<CategoryEvent, CategoryState> {
  List categorySubList;
  CategoryBloc() : super(CategoryInitial(null));
  @override
  Stream<CategoryState> mapEventToState(
    CategoryEvent event,
  ) async* {
    if (event is CategoryChangeEvent) {
      yield* _mapCategoryChangeEventToState(event);
    }
  }

  Stream<CategoryState> _mapCategoryChangeEventToState(
      CategoryChangeEvent event) async* {
    this.categorySubList = event.categorySubList;
    yield CategoryChangeState(this.categorySubList);
  }
}
